package com.student.model;

import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.google.gson.annotations.Expose;

/**
 * History entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "History", schema = "dbo", catalog = "NewStudent")
public class History implements java.io.Serializable {

	// Fields
	@Expose
	private Long historyId;
	@Expose
	private Tuser tuser;
	@Expose
	private OperateType operateType;
	@Expose
	private Student student;
	@Expose
	private Timestamp operateTime;
	@Expose
	private String operateDescription;

	// Constructors

	/** default constructor */
	public History() {
	}

	/** minimal constructor */
	public History(Timestamp operateTime, String operateDescription) {
		this.operateTime = operateTime;
		this.operateDescription = operateDescription;
	}

	/** full constructor */
	public History(Tuser tuser, OperateType operateType, Student student,
			Timestamp operateTime, String operateDescription) {
		this.tuser = tuser;
		this.operateType = operateType;
		this.student = student;
		this.operateTime = operateTime;
		this.operateDescription = operateDescription;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "HistoryId", unique = true, nullable = false, precision = 18, scale = 0)
	public Long getHistoryId() {
		return this.historyId;
	}

	public void setHistoryId(Long historyId) {
		this.historyId = historyId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "UserId")
	public Tuser getTuser() {
		return this.tuser;
	}

	public void setTuser(Tuser tuser) {
		this.tuser = tuser;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "OperateId")
	public OperateType getOperateType() {
		return this.operateType;
	}

	public void setOperateType(OperateType operateType) {
		this.operateType = operateType;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "StudentID",nullable=true)
	public Student getStudent() {
		return this.student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	@Column(name = "OperateTime", nullable = false, length = 23)
	public Timestamp getOperateTime() {
		return this.operateTime;
	}

	public void setOperateTime(Timestamp operateTime) {
		this.operateTime = operateTime;
	}

	@Column(name = "OperateDescription", nullable = false, length = 1024)
	public String getOperateDescription() {
		return this.operateDescription;
	}

	public void setOperateDescription(String operateDescription) {
		this.operateDescription = operateDescription;
	}

}